package com.spvs.system.common;

import lombok.Getter;

import java.util.Arrays;

/**
 * @description:审核状态枚举值
 * @authoer:jianghaijiao
 * @createDate:2024/6/19-10:09
 */

@Getter
public enum ApprovalStateEnum {

    PENDING_APPROVAL(1, "待审批"),
    UNDER_APPROVAL(2, "审批中"),
    PASSED_APPROVAL(3, "已通过"),
    REJECTED_APPROVAL(4, "已驳回");


    ApprovalStateEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private Integer code;
    private String desc;

    public static ApprovalStateEnum getByFormCode(Integer code) {
        return Arrays.stream(ApprovalStateEnum.values())
                .filter(value -> value.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
